Mapping instruction blocks based on block size

ABSTRACT

A processor core in an instruction block-based microarchitecture utilizes instruction blocks having headers that include an index to a size table that may be expressed using one of memory, register, logic, or code stream. A control unit in the processor core determines how many instructions to fetch for a current instruction block for mapping into an instruction window based on the block size that is indicated from the size table. As instruction block sizes are often unevenly distributed for a given program, utilization of the size table enables more flexibility in matching instruction blocks to the sizes of available slots in the instruction window as compared to arrangements in which instruction blocks have a fixed sized or are sized with less granularity. Such flexibility may enable denser instruction packing which increases overall processing efficiency by reducing the number of nops (no operations, such as null functions) in a given instruction block.

BACKGROUND

Designers of instruction set architectures (ISAs) and processors make power and performance trade-offs. For example, if a designer chooses an ISA with instructions that deliver higher performance, then the power consumption by the processor may be higher as well. Alternatively, if the designer chooses an ISA with instructions that consume lower power, then the performance may be lower. The power consumption may be tied to the amount of hardware resources of the processor, such as arithmetic logic units (ALUs), cache lines, or registers, used by the instructions during execution. Use of a large amount of such hardware resources may deliver higher performance at the cost of higher power consumption. Alternatively, the use of a small amount of such hardware resources may result in lower power consumption at the cost of lower performance. Compilers may be used to compile high-level code into instructions compatible with the ISA and the processor architecture.

SUMMARY

A processor core in an instruction block-based microarchitecture utilizes instruction blocks having headers that include an index to a size table that may be expressed using one of memory, register, logic, or code stream. A control unit in the processor core determines how many instructions to fetch for a current instruction block for mapping into an instruction window based on the block size that is indicated from the size table. As instruction block sizes are often unevenly distributed for a given program, utilization of the size table enables more flexibility in matching instruction blocks to the sizes of available slots in the instruction window as compared to arrangements in which instruction blocks have a fixed sized or are sized with less granularity. Such flexibility may enable denser instruction packing which increases overall processing efficiency by reducing the number of nops (no operations, such as null functions) in a given instruction block.

This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter. Furthermore, the claimed subject matter is not limited to implementations that solve any or all disadvantages noted in any part of this disclosure.

DESCRIPTION OF THE DRAWINGS

FIG. 1 shows an illustrative computing environment in which a compiler provides encoded instructions that run on an architecture that includes multiple processor cores;

FIG. 2 is a block diagram of an illustrative microarchitecture for an exemplary processor core;

FIG. 3 shows an illustrative arrangement for a block header; and

FIGS. 4-15 are flowcharts of illustrative methods.

Like reference numerals indicate like elements in the drawings. Elements are not drawn to scale unless otherwise indicated.

DETAILED DESCRIPTION

FIG. 1 shows an illustrative computing environment 100 with which the present instruction block mapping may be utilized. The environment includes a compiler 105 that may be utilized to generate encoded machine-executable instructions 110 from a program 115. The instructions 110 can be handled by a processor architecture 120 that is configured to process blocks of instructions of variable size containing, for example, between 4 and 128 instructions.

The processor architecture 120 typically includes multiple processor cores (representatively indicated by reference numeral 125) in a tiled configuration that are interconnected by an on-chip network (not shown) and further interoperated with one or more level 2 (L2) caches (representatively indicated by reference numeral 130). While the number and configuration of cores and caches can vary by implementation, it is noted that the physical cores can be merged together, in a process termed “composing” during runtime of the program 115, into one or more larger logical processors that can enable more processing power to be devoted to a program execution. Alternatively, when program execution supports suitable thread-level parallelism, the cores 125 can be split, in a process called “decomposing,” to work independently and execute instructions from independent threads.

FIG. 2 is a simplified block diagram of a portion of an illustrative processor core 125. As shown, the processor core 125 may include a front-end control unit 202, an instruction cache 204, a branch predictor 206, an instruction decoder 208, an instruction window 210, a left operand buffer 212, a right operand buffer 214, an arithmetic logic unit (ALU) 216, another ALU 218, registers 220, and a load/store queue 222. In some cases, the buses (indicated by the arrows) may carry data and instructions while in other cases, the buses may carry data (e.g., operands) or control signals. For example, the front-end control unit 202 may communicate, via a bus that carries only control signals, with other control networks. Although FIG. 2 shows a certain number of illustrative components for the processor core 125 that are arranged in a particular arrangement, there may be more or fewer components arranged differently depending on the needs of a particular implementation.

The front-end control unit 202 may include circuitry configured to control the flow of information through the processor core and circuitry to coordinate activities within it. The front-end control unit 202 also may include circuitry to implement a finite state machine (FSM) in which states enumerate each of the operating configurations that the processor core may take. Using opcodes (as described below) and/or other inputs (e.g., hardware-level signals), the FSM circuits in the front-end control unit 202 can determine the next state and control outputs.

Accordingly, the front-end control unit 202 can fetch instructions from the instruction cache 204 for processing by the instruction decoder 208. The front-end control unit 202 may exchange control information with other portions of the processor core 125 over control networks or buses. For example, the front-end control unit may exchange control information with a back-end control unit 224. The front-end and back-end control units may be integrated into a single control unit in some implementations.

The front-end control unit 202 may also coordinate and manage control of various cores and other parts of the processor architecture 120 (FIG. 1). Accordingly, for example, blocks of instructions may be simultaneously executing on multiple cores and the front-end control unit 202 may exchange control information via control networks with other cores to ensure synchronization, as needed, for execution of the various blocks of instructions.

The front-end control unit 202 may further process control information and meta-information regarding blocks of instructions that are executed atomically. For example, the front-end control unit 202 can process block headers that are associated with blocks of instructions. As discussed below in more detail, the block header may include control information and/or meta-information regarding the block of instructions. Accordingly, the front-end control unit 202 can include combinational logic, state machines, and temporary storage units, such as flip-flops to process the various fields in the block header.

The front-end control unit 202 may fetch and decode a single instruction or multiple instructions per clock cycle. The decoded instructions may be stored in an instruction window 210 that is implemented in processor core hardware as a buffer. The instruction window 210 can support an instruction scheduler 230, in some implementations, which may keep a ready state of each decoded instruction's inputs such as predications and operands. For example, when all of its inputs (if any) are ready, a given instruction may be woken up by instruction scheduler 230 and be ready to issue.

Before an instruction is issued, any operands required by the instruction may be stored in the left operand buffer 212 and/or the right operand buffer 214, as needed. Depending on the opcode of the instruction, operations may be performed on the operands using ALU 216 and/or ALU 218 or other functional units. The outputs of an ALU may be stored in an operand buffer or stored in one or more registers 220. Store operations that issue in a data flow order may be queued in load/store queue 222 until a block of instruction commits. When the block of instruction commits, the load/store queue 222 may write the committed block's stores to a memory. The branch predictor 206 may process block header information relating to branch exit types and factor that information in making branch predictions.

As noted above, the processor architecture 120 typically utilizes instructions organized in blocks that are fetched, executed, and committed atomically. Thus, a processor core may fetch the instructions belonging to a single block en masse, map them to the execution resources inside the processor core, execute the instructions, and commit their results in an atomic fashion. The processor may either commit the results of all instructions or nullify the execution of the entire block. Instructions inside a block may execute in a data flow order. In addition, the processor may permit the instructions inside a block to communicate directly with each other using messages or other suitable forms of communications. Thus an instruction that produces a result may, instead of writing the result to a register file, communicate that result to another instruction in the block that consumes the result. As an example, an instruction that adds the values stored in registers R1 and R2 may be expressed as shown in Table 1 below:

TABLE 1 I[0] READ R1 T[2R]; I[1]READ R2 T[2L]; I[2] ADD T[3L].

In this way, source operands are not specified with the instruction and instead, they are specified by the instructions that target the ADD instruction. The compiler 105 (FIG. 1) may explicitly encode the control and data dependencies during compilation of the instructions 110 to thereby free the processor core from rediscovering these dependencies at runtime. This may advantageously result in reduced processor load and energy savings during execution of these instructions. As an example, the compiler may use predication to convert all control dependencies into data flow instructions. Using these techniques, the number of accesses to power-hungry register files may be reduced. Table 2, below, shows an example of a general instruction format for such instructions:

TABLE 2 OPCODE PR BID XOP TARGET1 TARGET2

Each instruction may be of a suitable size, such as 32 bits, 64 bits, or another size. In the example shown in Table 2, each instruction may include an OPCODE field, a PR (predication) field, a BID (broadcast ID) field, an XOP (extended OPCODE) field, a TARGET1 field, and a TARGET2 field. The OPCODE field may specify a unique operation code for an instruction or a block of instructions, such as add, read, write, or multiply. The PR (predication) field may specify any predication associated with the instruction. For example, a two bit PR field may be used as follows: 00—not predicated, 01—reserved, 10—predicated on false, and 11—predicated on true. Thus, for example, if an instruction executes only if the result of a comparison is true, then that instruction may be predicated on the result of another instruction that performs the comparison. The BID (broadcast ID) field may support sending of an operand to any number of consumer instructions in a block. A 2-bit BID field may be used to encode the broadcast channel on which the instruction receives one of its operands. The XOP (extended OPCODE) field may support extending the types of opcodes. The TARGET1 and TARGET2 fields may allow up to two target instructions to be encoded. The target field may specify a consumer instruction of the result of the producer instruction, thus permitting direct communication between instructions.

Each block of instructions may have certain information associated with the block of instructions, such as control information and/or meta-information related to the block. This information may be generated by the compiler 105 during compilation of the program into the instructions 110 for execution on the processor architecture 120. Some of this information may be extracted by the compiler during compilation of a block of instructions and then examining the nature of the instructions during runtime.

In addition, the information associated with a block of instructions may be meta-information. For example, such information may be provided to a processor core using special instructions or instructions that provide target encoding related to registers or other memory that may have the relevant information associated with a block of instructions. In case of special instructions, the opcode field of such instructions can be used to communicate information relating to the block of instructions. In another example, such information may be maintained as part of the processor status word (PSW). For example, this information may advantageously help the processor execute the block of instructions more efficiently.

Various types of information can be provided to a processor core using a block header, special instructions, memory referenced locations, a processor status word (PSW), or various combinations thereof. An illustrative instruction block header 300 is shown in FIG. 3. In this illustrative example, the block header 300 is 128 bits and begins at offset 0 from a block's program counter. The respective beginning and ending of each field is also shown. The fields are described in Table 3 below:

TABLE 3 Field Description ID This field may be set to 1 to indicate the beginning of a valid instruction block. It may also include information regarding machine version and architecture version. In addition, this field may be used to indicate to the processor whether the block header has any ready bits or valid bits, such as, as part of the READY STATE field. SIZE This field may contain the number of 4 instruction chunks contained in an instruction block. Thus, for example, a value of 0 may indicate the smallest block of instructions in the block, e.g., a block header followed by 4 instructions. Alternatively or optionally, the SIZE field may include an encoded value that corresponds to an entry in a size table, or the field may include a pointer to a size table. XFLAGS This field may include execution flags that indicate special execution requirements:  XFLAGS[0] Vector Mode   This flag may indicate that the instructions will be copied   into independent vector lanes, each of which may include an   instruction window, operand buffers, an ALU, and registers.  XFLAGS[1] Inhibit Branch Predictor   This flag, when set, may result in the branch predictor being   inhibited. This may prevent the branch predictor from   predicting which way a branch (e.g., a predicated   instruction) will go before this is known for sure.  XFLAGS[2] Inhibit Memory Dependence Predictor   This flag, when set, may result in memory dependence   being inhibited. This may prevent the memory dependence   predictor from predicting dependencies between memory   operations, such as load/store operations.  XFLAGS[3] Block Synchronization Required   This flag, when set, may impose a requirement that another   block of instructions may not be executed on another   processor core in parallel with the current block of   instructions. In addition this flag, when set, may also   impose a requirement that the block of instructions may not   execute speculatively.  XFLAGS[4] Break After Block   This flag, when set, may indicate that there is a break after   the block of instructions.  XFLAGS[5] Break Before Block   This flag, when set, may indicate that there is break before   the block of instructions.  XFLAGS[6] Reserved   This flag may be reserved for future use.  XFLAGS[7] Reserved   This flag may be reserved for future use. EXIT TYPES This field may encode up to six 3-bit block exit types for use by the branch predictor.  000 - Null: may indicate to the branch predictor that there is no  information for the branch predictor in this field.  001 - Sequential: may indicate to the branch predictor that the  next branch is to the next block of instructions in the code. The  sequential branch exit type may be computed by factoring in the  current address of the block of instructions and the size of the  block of instructions, e.g., a current block address and the size of  the block.  010 - Offset: may indicate to the branch predictor that the next  branch is to an offset address, where the offset is treated as a  block offset.  011 - Indirect: may indicate to the branch predictor that the next  branch is an indirect type. Thus, for example, it may rely on a  register of a memory location that contains the address of the  first instruction of the successor block of instructions.  100 - Call: may indicate to the branch predictor that if the  successor block of instructions contains a subroutine call, then  the predicted branch goes to that successor block of instructions.  101 - Return: may indicate to the branch predictor that if the  successor block of instructions contains a return from a  subroutine call, then the predicted branch goes to that successor  block of instructions. Other bit patterns may be reserved for future uses. STORE MASK This field may identify the load-store identifiers (LSIDs) that are assigned to stores. For example, the LSQ block may have to receive each of the LSIDs assigned to stores for a block of instructions before the block of instructions is allowed to complete. WRITE MASK This field may identify the global registers that the block of instructions may write. For example, the register file may have to receive each entry of writes before the block of instructions is allowed to complete.

While the block header shown in FIG. 3 and described in Table 3 includes multiple fields, it is intended to be illustrative and other field arrangements may be utilized for a particular implementation.

In an illustrative example, the compiler 105 (FIG. 1) may select information for inclusion in a block header or for special instructions that can provide such information to a processor core based on the nature of the instructions and/or based on the nature of the processing requirements, such as high-performance or low-power. This may advantageously allow more optimal balancing of trade-offs between performance and power consumption. For certain types of processing applications, such as high performance computing with a large number of cores, a large amount of information may be a desirable option. Alternatively, for other types of processing applications, such as embedded processors used in the Internet of Things, mobile devices, wearable devices, head mounted display (HMD) devices, or other embedded computing type of applications, less information may be a desirable option.

The extent of the information communicated using a block header or special instructions can be tailored depending upon the nature of the instructions in a block. For example, if the block of instructions includes a loop that is executed in a recurring manner, then more extensive information might be needed to encapsulate the control information associated with that block. The additional control information may allow a processor core to execute the loop more efficiently to thereby improve performance.

Alternatively, if there is a block of instructions that will be rarely executed, then relatively less information may suffice. For example, if the block of instructions includes several predicated control loops, then more information may be needed. Similarly, if the block of instructions has an extensive amount of instruction level parallelism, then more information may be needed as part of a block header or special instructions.

The additional control information in the block header or special instructions may be used, for example, to effectively exploit the instruction level parallelism in the block of instructions. If the block of instructions includes several branch predictions, then more information may be needed. The additional control information regarding branch predictions will typically enhance code execution with more efficiency as it can result in fewer pipeline flushes.

It is noted that the functionality corresponding to the fields in the block header may be combined or further separated. Similarly, a special instruction may provide information related to any one of the fields shown in FIG. 3 and Table 3 or it may combine the information from such fields. For example, while the illustrative block header of FIG. 3 and Table 3 includes a separate ID field and a SIZE field, these two fields may be combined into a single field.

Likewise, a single special instruction may, when decoded, provide information regarding the size of the block of instructions and the information in the ID field. Unless indicated otherwise, the special instructions may be included anywhere in the block of instructions. For example, a BLOCK_SIZE #size instruction may contain an immediate field including a value of the size of a block of instructions. The immediate field may contain an integer value that provides the size information. Alternatively, the immediate field may include an encoded value relating to the size information so that the size information may be obtained by decoding the encoded value, for example, by looking up the value in a size table that may be expressed using one of logic, register, memory, or code stream. In another example, a BLOCK_ID #id special instruction may convey the block ID number.

A separate mathematical function or a memory-based table may map a block ID into the memory address of a block header. The block ID conveyed as part of such instruction may be unique to each block of instructions. In another example, a BLOCK_HDR_ID #id instruction may convey the block header ID number. A separate mathematical function or a memory-based table may map the block ID into the memory address of a block header. The block ID conveyed as part of such instruction may be shared by several blocks of instructions with the same header structure or fields.

In another example, a BLOCK_INFO #size, #exit types, #store mask, #write mask instruction may provide information regarding the enumerated fields of the instruction. These fields may correspond to any one of the fields discussed above with respect to Table 3. Other changes may be made to the block header structure and format and special instructions according to requirements of a given implementation. For example, additional fields may be provided that include information relating to the characteristics of a block of instructions. Particular fields can be included based on the frequency of the execution of the block of instructions.

The fields included in the block header structure, or information provided via special instructions or other mechanisms discussed earlier, may be part of a publicly available standard Instruction Set Architecture (ISA) of a particular processor or a family of processors. A subset of the fields may be a proprietary extension to the ISA. Certain bit values in the field may be part of the standard ISA for the processor, but certain other bit values in the field may provide proprietary functionality. This exemplary field may allow an ISA designer to add proprietary extensions to the ISA without disclosing entirely the nature and the functionality associated with the proprietary extension. Thus, in this instance, the compiler tools distributed by the ISA designer would support the proprietary bit values in the field, an entirely separate proprietary field, or a special instruction. The use of such a field may be particularly relevant to hardware accelerators that are proprietary to certain processor designs. Thus, a program may include a block header field or a special instruction that is unrecognizable; but the program may further include a recipe to decipher the field or decode the instruction.

The compiler 105 (FIG. 1) may process a block of instructions, which are typically configured to execute atomically by one more processor cores, in order to generate information about the block of instructions, including meta-information and control information. Some programs may be compiled for only one ISA, for example, an ISA used with processors for the Internet of Things, mobile devices, HMD devices, wearable devices, or other embedded computing environments. The compiler may employ techniques, such as static code analysis or code profiling to generate information that is relevant to the block of instructions. In some cases, the compiler may consider factors such as the characteristics of the block of instructions and its frequency of execution. The relevant characteristics of the block of instructions may include, for example, but are not necessarily limited to (1) the instruction level parallelism, (2) the number of loops, (3) the number of predicated control instructions, and (4) the number of branch predictions.

FIG. 4 is a flowchart of an illustrative method 400 for managing instruction blocks in an instruction window disposed in a processor core. Unless specifically stated, the methods or steps in the flowchart of FIG. 4 and those in the other flowcharts shown in the drawings and described below are not constrained to a particular order or sequence. In addition, some of the methods or steps thereof can occur or be performed concurrently and not all the methods or steps have to be performed in a given implementation depending on the requirements of such implementation and some methods or steps may be optionally utilized. Likewise, some steps may be eliminated in some implementations to reduce overhead but this may result in increased brittleness, for example. The various feature, cost, overhead, performance, and robustness tradeoffs which may be implemented in any given application may be typically viewed as a matter of design choice.

In step 405, the ages of fetched instruction blocks are explicitly tracked using, for example, an age vector. Thus, rather than use instruction block order (i.e., position) in the instruction window, which is typically used to implicitly track age, the control unit maintains explicit state. An age-ordered list of instruction blocks is maintained in step 410. Instruction block priority (where priority may be determined by the compiler in some cases) may also be tracked and a priority-ordered list of instruction blocks may also be maintained in some implementations.

In step 415, when an instruction block is identified for handling, the age-ordered list is searched to find a matching instruction block. The priority-ordered list may also be searched in some implementations for a match. If a matching instruction block is found, then it can be refreshed, in step 420, without having to re-fetch it from the instruction cache which can improve processor core efficiency. Such refreshing enables reuse of the instruction block in situations, for example, when a program executes in a tight loop and instructions branch back on themselves. Such efficiency increases may also be compounded when multiple processor cores are composed into a large scale array. When refreshing an instruction block, the instructions are left in place and only the valid bits in the operand buffer and load/store queue are cleared.

If a match to the instruction block is not found, then the age-ordered list (or the priority-ordered list) can be utilized again to find an instruction block that can be committed to open a slot in the instruction window for the new instruction block. For example, the oldest instruction block or the lowest priority instruction block may be committed (where a high priority block may be desired to keep buffered since there is likelihood of its future reuse). In step 425, the new instruction block is mapped into the available slot. The instruction block can be allocated using a bulk allocation process in which instructions in the block and all the resources associated with the instructions are fetched at once (i.e., en masse).

In step 430, the new instruction block is executed so that its instructions are committed atomically. Other instruction blocks may be executed in order of age, in a similar manner to a conventional reorder buffer, in step 435 to commit their respective instructions in an atomic manner.

FIG. 5 is a flowchart of an illustrative method 500 that may be performed by an instruction block-based microarchitecture. In step 505, a control unit in a processor core causes fetched instruction blocks to be buffered with either contiguous replacement or non-contiguous replacement. In step 510, with contiguous instruction block replacement, the buffer can be operated like a circular buffer. In step 515, with non-contiguous instruction block replacement, instruction blocks may be replaced out of order. For example, in step 520 explicit age-based tracking can be performed so that instruction blocks are committed and replaced based on the tracked ages, in a similar manner as described above. Priority can also be tracked and the tracked priority may be used to commit and replace instruction blocks in step 525.

FIG. 6 is a flowchart of an illustrative method 600 that may be performed by a control unit disposed in a processor core. In step 605, the state of buffered instruction blocks is tracked and a list of instruction blocks is maintained using the tracked state in step 610. For example, state can include age, priority, or other information or context depending on particular implementation requirements. In step 615, when an instruction block is identified for mapping, the list is checked for a match, as shown in step 620. A matching instruction block from the list is refreshed without re-fetching in step 625. When a matching instruction block is not found in the list, then the instruction block is fetched from the instruction cache and mapped into an available slot in the instruction window in step 630 in a similar manner as described above.

FIG. 7 is a flowchart of an illustrative method 700 for managing instructions blocks in an instruction window disposed in a processor core. In step 705, a size table of instruction block sizes is maintained in the processor core. The size table can be expressed in various ways, for example, using one of logic, register, memory, code stream, or other suitable construct. In step 710, an index that is encoded in a header of an instruction block is read. The instruction block includes one or more decoded instructions. Accordingly, rather than using the SIZE field shown in FIG. 3 and Table 3 to hard code an instruction block size, the field may be used to encode or store an index to the size table. That is, the index may function as a pointer to an entry in the size window to enable a particular size to be associated with the instruction block.

The number of size entries that are included in the size table can vary by implementation. A greater number of size entries may be utilized to enable more granularity which may be beneficial in cases where there is a relatively wide distribution of instruction block sizes associated with a given program, but at a cost of increased overhead in typical implementations. In some cases, the number of sizes included in the table can be selected by the compiler to cover a particular distribution of instruction block sizes in a way that optimizes overall instruction packing density and to minimize no ops. For example, the sizes included in the size table can be selected to match commonly used block instruction sizes in the program. In step 715, the index is used to look up an instruction block size from the size table. The instruction block is mapped into an available slot in the instruction window based on its size in step 720.

In some implementations, as shown in step 725, the instruction window may be segmented into two or more sub-windows, for example, that use two or more different sizes. Such variation in the segmented sub-windows may enable further accommodation for a given distribution of instruction block sizes and may further increase instruction packing density. The segmentation may also be dynamically performed in some scenarios.

FIG. 8 is a flowchart of an illustrative method 800 that may be performed by an instruction block-based microarchitecture. In step 805, a size table is implemented. As discussed above, the size table may be implemented using one of logic, register, memory, code stream, or other suitable construct and may include sizes that correspond to those which are commonly utilized in a distribution of instruction blocks utilized by a given program. In step 810, an instruction block header is inspected for a pointer that refers to an entry in the size table. In step 815, the size identified by the table entry is used to determine placement of the instruction block within the instruction window.

In step 820, resources associated with the instruction block are bulk allocated. Restrictions designated in the instruction block header are used when mapping the instruction block in the instruction window in step 825. These may include, for example, restrictions on alignment and the capacity of the instruction window to buffer instruction blocks. In step 830, the order of the instruction blocks in the instruction window is tracked by the control unit and blocks may be committed out of order in some situations. For example, rather than use a circular buffer of instruction blocks in which blocks are handled based on their position in the instruction window, blocks can be prioritized so that heavily used, or particularly important instruction blocks are handled out of order which can increase processing efficiency.

In step 835, the age of instruction blocks can be explicitly tracked and instruction blocks can be committed based on such explicitly-tracked age in some cases. The instruction block is refreshed in step 840 (that is, reused without having to re-fetch the instruction block from the instruction cache).

FIG. 9 is a flowchart of an illustrative method 900 that may be performed by a control unit disposed in a processor core. In step 905, the instruction window is configured with multiple segments that have two or more different sizes in a similar manner to that described above. In step 910, the block instruction header is inspected for an index that is encoded therein. A look up is performed in the size table using the index in step 915 and the instruction block is placed into an instruction window segment that is suitable for the particular size of the block, based on the size look up, in step 920. Resources associated with the instruction block are fetched, in step 925, using bulk allocation.

FIG. 10 is a flowchart of an illustrative method 1000 for managing instruction blocks in an instruction window disposed in a processor core. In step 1005, an instruction block is mapped from the instruction cache into the instruction window. The instruction block includes one or more decoded instructions. Resources that are associated with each of the instructions in the instruction block are allocated in step 1010. The resources typically include control bits and operands and the allocation may be performed using a bulk allocation process in which all of the resources are obtained or fetched en masse.

Instead of tightly coupling the resources and instructions, the instruction window and operand buffers are decoupled so that they can be operated independently by maintaining one or more pointers among the resources and the decoded instructions in the block, as shown in step 1015. When an instruction block is refreshed in step 1020 (that is, reused without having to re-fetch the instruction block from the instruction cache), then the resources can be reused by following the pointers back to an original control state in step 1025.

Such decoupling may provide increased processor core efficiency, particularly when instruction blocks are refreshed without re-fetching as typically occurs, for example, when a program executes in a tight loop and instructions are repeatedly utilized. By establishing control state through the pointers, the resources are effectively pre-validated without additional expenditure of processing cycles and other costs. Such efficiency increases may also be compounded when multiple processor cores are composed into a large scale array.

FIG. 11 is a flowchart of an illustrative method 1100 that may be performed by an instruction block-based microarchitecture. In step 1105, instruction blocks are mapped into the instruction window in a manner in which a new instruction block replaces a committed instruction block. The mapping may be subject to various restrictions that are designated in the header of the instruction block, for example, restrictions on alignment and the capacity of the instruction window to buffer instruction blocks, as indicated in step 1110. Resources are allocated in step 1115 for the new instruction block, which typically is implemented using a bulk allocation process, as described above.

In step 1120, the order of the instruction blocks in the instruction window is tracked by the control unit and blocks may be committed out of order in some situations. For example, rather than use a circular buffer of instruction blocks in which blocks are handled based on their position in the instruction window, blocks can be prioritized so that heavily used, or particularly important instruction blocks are handled out of order which can increase processing efficiency.

In step 1125, the instruction window is decoupled from the operand buffer so that, for example, blocks of instructions and blocks of operands are managed independently (i.e., without using a strict correspondence between instructions and operands). As noted above, the decoupling increases efficiency by enabling resources to be pre-validated when an instruction block is refreshed.

FIG. 12 is a flowchart of an illustrative method 1200 that may be performed by a control unit disposed in a processor core. In step 1205, an instruction window is maintained for buffering one or more instruction blocks. One or more operand buffers are maintained in step 1210 for buffering resources associated with the instructions in the instruction block. As noted above, resources typically include control bits and operands. State is tracked using pointers among the instructions and the resources in step 1215.

When an instruction block is refreshed, in block 1220, the pointers can be followed back to the tracked state. In step 1225, when an instruction blocks commits, the control bits in the operand buffer are cleared and a new pointer is set. As with the method discussed above, the instruction window and operand buffers are decoupled so that blocks of instructions and blocks of operands are maintained by the control unit on a non-corresponding basis, in step 1230.

FIG. 13 is a flowchart of an illustrative method 1300 for managing instruction blocks in an instruction window disposed in a processor core. In step 1305, instruction blocks are allocated using a bulk allocation process in which instructions in the block and all the resources associated with the instructions are fetched at once (i.e., en masse). In comparison to conventional architectures in which instructions and resources are repeatedly fetched in smaller chunks, the bulk allocation here enables all of the instructions in the block to be managed simultaneously and consistently which can improve efficiency of processor core operations. This improvement may be even more significant in situations where a given programming construct (e.g., one that minimizes branching) enables the compiler to generate relatively large instruction blocks. For example, in some implementations, an instruction block may contain up to 128 instructions.

The bulk allocation of instruction blocks also enhances processor core efficiency through the refresh feature in which instruction blocks are reused without re-fetching as typically occurs, for example, when a program executes in a tight loop and instructions branch back on themselves. Such efficiency increases may also be compounded when multiple processor cores are composed into a large scale array. When refreshing an instruction block, the instructions are left in place and only the valid bits in the operand buffer and load/store queue are cleared. This enables the fetching of the refreshed instruction blocks to be bypassed entirely.

The bulk allocation of instruction blocks also enables additional processing efficiencies when a group of instructions and resources are in place. For example, operands and explicit messages may be sent from one instruction in the block to another. Such functionality is not enabled in conventional architectures because one instruction is unable to send anything to another instruction that has yet to be allocated. Instructions that generate constants can also pin values in the operand buffers so that they remain valid after refresh so they do not need to be regenerated each time the instruction block executes.

When instruction blocks are mapped into the instruction window, in step 1310, they are subject to constraints that may be applied by mapping policies, restrictions designated in the block header, or both in step 1315. In some cases, the policies can be set by a compiler depending on the particular requirements of a given program. The designated restrictions can include, for example, restrictions on alignment and the restrictions on the capacity of the instruction window to buffer instruction blocks.

In step 1320, the instruction window can, in some implementations, be segmented into sub-windows of the same size or different sizes. As instruction block sizes are often randomly or unevenly distributed for a given program, such variation in the segmented sub-windows may more efficiently accommodate a given distribution of instruction block sizes to thereby increase instruction packing density in the instruction window. The segmentation may also be dynamically performed in some scenarios depending on the distribution of block sizes that is being currently handled by the processor core.

In some implementations, the instruction block header may encode an index or include a pointer to a size table that is implemented using one of logic, register, memory, or code stream. The size table can include instruction block size entries so that an instruction block size can be looked up from the table in step 1325. Use of the encoded index and size table may enhance instruction packing density in an instruction block by affording more granularity in available block sizes to reduce the occurrence of nops (no operations) when a block includes a relatively small number of instructions when implementing branching, for example.

FIG. 14 is a flowchart of an illustrative method 1400 that may be performed by an instruction block-based microarchitecture. In step 1405, a control unit in a processor core applies policies for handling instruction blocks. The instruction blocks are allocated in step 1410 using a bulk allocation process described above in which instructions and all associated resources are fetched at once. In step 1415, instruction blocks are mapped into the instruction window in which the mapping may be subject to various restrictions, such as restrictions on alignment and restrictions on the capacity of the instruction window to buffer instruction blocks that are designated in the header of the instruction block, as described above.

In step 1420, a policy may be applied that includes tracking the order of the instruction blocks in the instruction window by the control unit. Blocks may be committed out of order in some situations, for example, rather than using a circular buffer of instruction blocks in which blocks are handled based on their position in the instruction window. In step 1425, a policy may be applied that includes handling blocks based on priority (which may be designated by the compiler in some scenarios) so that blocks which are heavily used, or are particularly important, are handled out of order which can further increase processing efficiency.

In step 1430, a policy may be applied that includes explicitly tracking the age of instruction blocks and instruction blocks can be committed based on such explicitly-tracked age in some cases. In step 1435, a policy may be applied that includes mapping instruction blocks according to the availability of a suitably sized slot in the instruction window (or a segment of the window). In step 1440, a policy may be applied that includes mapping instruction blocks into the instruction window using a circular buffer.

In some implementations, various combinations of policies may be utilized in order to further enhance processor core efficiency. For example, the control unit may dynamically toggle among policies to apply a policy that provides more optimal operations for a given instruction block or group of instruction blocks. For example, in some scenarios, it may be more efficient to use a circular buffering technique in which instruction blocks are handled in order in a contiguous manner. In other scenarios, out of order and age-based handling may provide more optimal operations.

FIG. 15 is a flowchart of an illustrative method 1500 that may be performed by a control unit disposed in a processor core. In step 1505, the instruction window is configured with multiple segments that have two or more different sizes in a similar manner to that described above. In step 1510, an instruction block is fetched and all its associated resources are fetched in step 1515.

In step 1520, an instruction block is placed in a suitable segment of the window that maximizes instruction density in the window. For example, if the compiler produces a distribution of block sizes that includes a relatively large number of blocks with low instruction count (e.g., to implement program branching and the like), then the instruction window may have a segment that is specifically sized for small instruction blocks. Similarly, if there is a relatively large number of high instruction count blocks (e.g., for scientific and similar applications), then a segment may be specifically sized for such larger instruction blocks. Thus, the instruction window segment sizing can be adjusted according to a particular size distribution or be dynamically adjusted in some situations when the distribution changes. In block 1525, instruction blocks may be subject to restrictions designated in the instruction block header, as discussed above.

Various exemplary embodiments of the present mapping of instruction blocks based on block size are now presented by way of illustration and not as an exhaustive list of all embodiments. An example includes a method for managing instruction blocks in an instruction window disposed in a processor, comprising: maintaining a size table of instruction block sizes; reading an index encoded in a header of an instruction block, in which the instruction block includes one or more instructions; looking up an instruction block size from the size table using the index; and mapping the instruction block into an available slot in an instruction window based on the size look up in order to maximize instruction packing within the instruction window. In a further example, the method includes segmenting the instruction window into sub-windows. In another example, the method further includes configuring the segmented sub-windows to share a common size or be implemented using two or more different sizes. In another example, the segmented sub-windows are sized dynamically according to a distribution of instruction block sizes. In another example, the method further includes maintaining the size table as a logical size table that is expressed using one of logic, register, memory, or code stream. In another example, the method further includes setting the sizes in the size table to match commonly used sizes among a distribution of instruction block sizes associated with a program.

A further example includes an instruction block-based microarchitecture, comprising: a control unit; one or more operand buffers; and an instruction window configured to store decoded instruction blocks associated with a program to be under control of the control unit in which the control includes operations to: implement a size table using one of logic, register, memory, or code stream, in which the size table includes two or more different sizes that correspond to commonly utilized sizes within a distribution of instruction blocks used in the program, inspect a pointer in a header of an instruction block, in which the pointer refers to an instruction block size identified in the size table, and determine a placement of an instruction block in the instruction window based on the size identified from the table. In another example, the instruction block-based microarchitecture further includes a configuration to perform bulk allocation for each instruction block to obtain resources that are associated with instructions in the block. In another example, the instruction block-based microarchitecture further includes a configuration to map the instruction blocks based on restrictions designated in a header of the instruction block in which the designated restrictions include one of alignment restrictions or instruction block capacity restrictions of the instruction window. In another example, the instruction block-based microarchitecture further includes a configuration to track an order of the instruction blocks in the instruction window and committing an instruction block out of order. In another example, the instruction block-based microarchitecture further includes a configuration to explicitly track ages of instruction blocks currently mapped in the instruction window and committing an instruction block based on an explicitly-tracked age. In another example, the instruction block-based microarchitecture further includes a configuration to map instruction blocks to the instruction window when a slot in the instruction window is available that fits the instruction block. In another example, the instruction block-based microarchitecture further includes a configuration to map instruction blocks to the instruction window using a circular buffer. In another example, the instruction block-based microarchitecture further includes a configuration to refresh the instruction block without re-fetching the instruction block from an instruction cache.

A further example includes a control unit disposed in a processor that is arranged to perform a method for instruction block management, comprising: configuring an instruction window with multiple segments, in which segments have two or more different sizes; inspecting a header of an instruction block for an index encoded therein, in which the instruction block includes one or more instructions; looking up an instruction block size from the size table using the index; and placing the instruction block into a segment of the instruction window based on the size look up. In another example, the control unit further includes inspecting a header of the instruction block for designated restrictions on placement within an instruction window and performing the placing in accordance with the designated restrictions, in which the designated restrictions include one of alignment restrictions or instruction block capacity restrictions. In another example, the control unit further includes configuring the segmented instruction window as a logical segmented instruction window that is distributed over a plurality of processor cores. In another example, the control unit further includes maintaining state across the logical segmented instruction window using communications carried over an in-chip network. In another example, the control unit further includes performing fetching of resources as a bulk allocation. In another example, the control unit further includes refreshing the instruction block without re-fetching the instruction block from an instruction cache.

The subject matter described above is provided by way of illustration only and should not be construed as limiting. Various modifications and changes may be made to the subject matter described herein without following the example embodiments and applications illustrated and described, and without departing from the true spirit and scope of the present disclosure, which is set forth in the following claims. 

What is claimed:
 1. A method for managing instruction blocks in an instruction window disposed in a processor, comprising: maintaining a size table of instruction block sizes; reading an index encoded in a header of an instruction block, in which the instruction block includes one or more instructions; looking up an instruction block size from the size table using the index; and mapping the instruction block into an available slot in an instruction window based on the size look up in order to maximize instruction packing within the instruction window.
 2. The method of claim 1 further including segmenting the instruction window into sub-windows.
 3. The method of claim 2 further including configuring the segmented sub-windows to share a common size or be implemented using two or more different sizes.
 4. The method of claim 3 in which the segmented sub-windows are sized dynamically according to a distribution of instruction block sizes.
 5. The method of claim 1 further including maintaining the size table as a logical size table that is expressed using one of logic, register, memory, or code stream.
 6. The method of claim 1 further including setting the sizes in the size table to match commonly used sizes among a distribution of instruction block sizes associated with a program.
 7. An instruction block-based processor, comprising: a control unit; one or more operand buffers; and an instruction window configured to store decoded instruction blocks associated with a program to be under control of the control unit in which the control includes operations to: implement a size table using one of logic, register, memory, or code stream, in which the size table includes two or more different sizes that correspond to commonly utilized sizes within a distribution of instruction blocks used in the program, inspect a pointer in a header of an instruction block, in which the pointer refers to an instruction block size identified in the size table, and determine a placement of an instruction block in the instruction window based on the size identified from the table.
 8. The instruction block-based processor of claim 7 further including a configuration to perform bulk allocation for each instruction block to obtain resources that are associated with instructions in the block.
 9. The instruction block-based processor of claim 7 further including a configuration to map the instruction blocks based on restrictions designated in a header of the instruction block in which the designated restrictions include one of alignment restrictions or instruction block capacity restrictions of the instruction window.
 10. The instruction block-based processor of claim 7 further including a configuration to track an order of the instruction blocks in the instruction window and committing an instruction block out of order.
 11. The instruction block-based processor of claim 7 further including a configuration to explicitly track ages of instruction blocks currently mapped in the instruction window and committing an instruction block based on an explicitly-tracked age.
 12. The instruction block-based processor of claim 7 further including a configuration to map instruction blocks to the instruction window when a slot in the instruction window is available that fits the instruction block.
 13. The instruction block-based processor of claim 7 further including a configuration to map instruction blocks to the instruction window using a circular buffer.
 14. The instruction block-based processor of claim 7 further including a configuration to refresh the instruction block without re-fetching the instruction block from an instruction cache.
 15. A control unit disposed in a processor that is arranged to perform a method for instruction block management, comprising: configuring an instruction window with multiple segments, in which segments have two or more different sizes; inspecting a header of an instruction block for an index encoded therein, in which the instruction block includes one or more instructions; looking up an instruction block size from the size table using the index; and placing the instruction block into a segment of the instruction window based on the size look up.
 16. The control unit of claim 15 further including inspecting a header of the instruction block for designated restrictions on placement within an instruction window and performing the placing in accordance with the designated restrictions, in which the designated restrictions include one of alignment restrictions or instruction block capacity restrictions.
 17. The control unit of claim 15 further including configuring the segmented instruction window as a logical segmented instruction window that is distributed over a plurality of processor cores.
 18. The control unit of claim 17 further including maintaining state across the logical segmented instruction window using communications carried over an in-chip network.
 19. The control unit of claim 15 further including performing fetching of resources as a bulk allocation.
 20. The control unit of claim 15 further including refreshing the instruction block without re-fetching the instruction block from an instruction cache. 